import * as Sequelize from 'sequelize';
import { DataTypes, Model, Optional } from 'sequelize';

export interface browseAttributes {
  id: number;
  userId?: number;
  noteId?: number;
  createdAt?: Date;
  updatedAt?: Date;
}

export type browsePk = "id";
export type browseId = browse[browsePk];
export type browseOptionalAttributes = "id" | "userId" | "noteId" | "createdAt" | "updatedAt";
export type browseCreationAttributes = Optional<browseAttributes, browseOptionalAttributes>;

export class browse extends Model<browseAttributes, browseCreationAttributes> implements browseAttributes {
  id!: number;
  userId?: number;
  noteId?: number;
  createdAt?: Date;
  updatedAt?: Date;


  static initModel(sequelize: Sequelize.Sequelize): typeof browse {
    return browse.init({
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      primaryKey: true
    },
    userId: {
      type: DataTypes.INTEGER,
      allowNull: true
    },
    noteId: {
      type: DataTypes.INTEGER,
      allowNull: true
    }
  }, {
    sequelize,
    tableName: 'browse',
    timestamps: true,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
  }
}
